<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GridViewUpdatingForm.aspx.cs" Inherits="QSWebApplicationCSharp.GridViewUpdatingForm" %>

<%@ Register Assembly="ValidationFramework.Web.ASP" Namespace="ValidationFramework.Web.ASP" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:GridView ID="personGridView" runat="server" AutoGenerateColumns="False" DataSourceID="personObjectDataSource" OnDataBound="personGridView_DataBound" OnRowUpdating="personGridView_RowUpdating" >
        <Columns>
          <asp:CommandField ShowEditButton="True" CausesValidation="True" />
          <asp:TemplateField HeaderText="FirstName" SortExpression="FirstName">
            <EditItemTemplate>
              <asp:TextBox ID="firstNameTextBox" runat="server" Text='<%# Bind("FirstName") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
              <asp:Label ID="firstNameLabel" runat="server" Text='<%# Bind("FirstName") %>'></asp:Label>
            </ItemTemplate>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="LastName" SortExpression="LastName">
            <EditItemTemplate>
              <asp:TextBox ID="lastNameTextBox" runat="server" Text='<%# Bind("LastName") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
              <asp:Label ID="lastNameLabel" runat="server" Text='<%# Bind("LastName") %>'></asp:Label>
            </ItemTemplate>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="EmailAddress" SortExpression="EmailAddress">
            <EditItemTemplate>
              <asp:TextBox ID="emailAddressTextBox" runat="server" Text='<%# Bind("EmailAddress") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
              <asp:Label ID="emailAddressLabel" runat="server" Text='<%# Bind("EmailAddress") %>'></asp:Label>
            </ItemTemplate>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="CreditCardNumber" SortExpression="CreditCardNumber">
            <EditItemTemplate>
              <asp:TextBox ID="creditCardNumberTextBox" runat="server" Text='<%# Bind("CreditCardNumber") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
              <asp:Label ID="creditCardNumberLabel" runat="server" Text='<%# Bind("CreditCardNumber") %>'></asp:Label>
            </ItemTemplate>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="OrderTotal" SortExpression="OrderTotal">
            <EditItemTemplate>
              <asp:TextBox ID="orderTotalTextBox" runat="server" Text='<%# Bind("OrderTotal") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
              <asp:Label ID="orderTotalLabel" runat="server" Text='<%# Bind("OrderTotal") %>'></asp:Label>
            </ItemTemplate>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Age" SortExpression="Age">
            <EditItemTemplate>
              <asp:TextBox ID="ageTextBox" runat="server" Text='<%# Bind("Age") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
              <asp:Label ID="ageLabel" runat="server" Text='<%# Bind("Age") %>'></asp:Label>
            </ItemTemplate>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="PhoneNumber" SortExpression="PhoneNumber">
            <EditItemTemplate>
              <asp:TextBox ID="phoneNumberTextBox" runat="server" Text='<%# Bind("PhoneNumber") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
              <asp:Label ID="phoneNumberLabel" runat="server" Text='<%# Bind("PhoneNumber") %>'></asp:Label>
            </ItemTemplate>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="CardType" SortExpression="CardType">
            <EditItemTemplate>
              &nbsp;<asp:DropDownList ID="cardTypeDropDownList" runat="server" SelectedValue='<%# Bind("CardType") %>'>
                <asp:ListItem Selected="True" Value="Visa"></asp:ListItem>
                <asp:ListItem Value="MasterCard"></asp:ListItem>
                <asp:ListItem>Amex</asp:ListItem>
              </asp:DropDownList>
            </EditItemTemplate>
            <ItemTemplate>
              <asp:Label ID="cardTypeLabel" runat="server" Text='<%# Bind("CardType") %>'></asp:Label>
            </ItemTemplate>
          </asp:TemplateField>
        </Columns>
      </asp:GridView>
      &nbsp;
    
    </div>
      <asp:ObjectDataSource ID="personObjectDataSource" runat="server"
        SelectMethod="GetAllPeople" TypeName="QSBusinessLayerCSharp.PersonMapper"   DataObjectTypeName="QSBusinessLayerCSharp.Person" UpdateMethod="SaveOrUpdate"  >
      </asp:ObjectDataSource>
      <cc1:PropertyValidatorGeneratorControl id="validatorGenerator" runat="server" 
        onTargetObjectRequired="validatorGenerator_TargetObjectRequired" typeToValidate="QSBusinessLayerCSharp.Person,QSBusinessLayerCSharp"></cc1:PropertyValidatorGeneratorControl>
    </form>
</body>
</html>
